<?php
    class News_model extends CI_Model {
        
        function __construct() {
            parent::__construct();
        }
        
        function get_last_ten_entries(){
            $this->db->order_by('news_id', 'desc');
            $query = $this->db->get('news', 20);
            return $query->result_array();
        }
        
        function drop_one_entrie($id){
            $this->db->where('news_id', $id);
            $this->db->delete('news');
        }
        
        function insert_one_entrie($data){
            $this->db->insert('news', $data);
        }
        
        function get_one_entrie($id) {
            $this->db->where('news_id', $id);
            $query = $this->db->get('news');
            return $query->result_array();
        }
        
        function update_one_entrie($id, $data) {
            $this->db->where('news_id', $id);
            $this->db->update('news', $data);
        }
    }
?>
